<template>
    <div class="markdown-content" v-html="compiledMarkdown"></div>
  </template>
  
  <script>
  import MarkdownIt from 'markdown-it';
  import mk from '@iktakahiro/markdown-it-katex';
  
  const md = new MarkdownIt().use(mk, {
    throwOnError: false // 避免公式错误导致渲染中断
  });
  
  export default {
    props: ['content'],
    computed: {
      compiledMarkdown() {
        return md.render(this.content || '');
      }
    }
  };
  </script>
  
  <style>
  @import 'katex/dist/katex.min.css';
  </style>